gesturesingle: check for the sequence being handled, not just the event
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 20 Nov 2014 12:25:40 +0000 (13:25 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 18 Dec 2014 20:20:17 +0000 (21:20 +0100)
Checking the return value was valid for most gestures, but
GtkGestureLongPress, where the first press triggers internally an action,
but does nothing for the sequence to be claimed/denied, FALSE was eventually
returned, and the button/sequence functions would be incorrect when
::pressed is emitted.

So check that the sequence is being handled by the gesture, this is more
desirable than the return value as it's independent of sequence state,
and still will be FALSE for the cases we want to catch here.

gtk/gtkgesturesingle.c

index c549e6d23dd2bc2e5107aad6aa68960d1f3175fe..458bffe5ecea1b2e8e1d32628444a8001ff17ad7 100644 (file)
@@ -220,7 +220,8 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
   if (sequence == priv->current_sequence &&
       (event->type == GDK_BUTTON_RELEASE || event->type == GDK_TOUCH_END))
     priv->current_button = 0;
-  else if (!retval)
+  else if (priv->current_sequence == sequence &&
+           !gtk_gesture_handles_sequence (GTK_GESTURE (controller), sequence))
     {
       if (button == priv->current_button && event->type == GDK_BUTTON_PRESS)
         priv->current_button = 0;